let calNum = 4*10**8;

function test() {
    let sum = 0;
    for (var i = 0; i < calNum; i++) {
        sum += i;
    }
    return sum;
}


function test2() {
    let s=[];
    for (var i = 0; i < calNum; i++) {
        s[i]="hello";
    }
    return s;
}


let start =  new Date().getTime();

test();

let end =  new Date().getTime();

console.log((end - start) / 1000);